package com.iam.core.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iam.core.entities.IParams;
import com.iam.core.entities.Result;
import com.iam.core.mapper.ArgsMapper;
import com.iam.core.model.SysArgs;
import com.iam.core.service.AbstractBaseCommonService;
import com.iam.core.utils.ResultUtil;
import com.iam.core.service.ArgsService;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class ArgsServiceImpl extends AbstractBaseCommonService<ArgsMapper, SysArgs> implements ArgsService {

    @Override
    public Page<SysArgs> selectPage(IParams entity) {
        Page<SysArgs> page = new Page<>(entity.getPage(), entity.getPageSize());
        return page(page, buildWrapper(entity));
    }

    @Override
    public Result saves(SysArgs entity) {
        if (this.save(entity)) {
            return ResultUtil.success("新增成功");
        }
        return ResultUtil.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), "新增失败");
    }
}
